package com.pi.shisan.test.receiver;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;

/**
 * @author Shisan
 * @version V1.0.0
 * @Package com.test.server.handler
 * @ClassName: MessageConvert
 * @Description: 数据长度识别
 * @date 2019年12月17日 11:05
 */
public class MessageValid extends LengthFieldBasedFrameDecoder {

    public MessageValid() {
        super(Integer.MAX_VALUE, 2, 2);
    }

    @Override
    protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
        return super.decode(ctx, in);
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        cause.printStackTrace();
        super.exceptionCaught(ctx, cause);
    }
}
